<template>
	<!-- 划转记录 -->
	<view class="transferred-record">
		<nav-bar :title="i18n.transferred.record" @_back="_back"/>
		<view class="container">
			<record-list v-for="item in list" :key="item.id" :obj="item" @click="recordClick(item.id)" />
		</view>
		<u-empty v-if="isEmpty && !list.length" :text="i18n.common.noHistory" mode="history"></u-empty>
		<custom-loading text="" mask="true" click="true" ref="loading"></custom-loading>
	</view>
</template>

<script>
	import minix from '@/utils/minix.js'
	import RecordList from '@/components/Record/index.vue'
	import { walletHzhistory } from '@/api/index.js'
	import { mapGetters } from 'vuex'
	import CustomLoading from '@/components/Loadidng/index.vue'
	export default {
		mixins: [minix],
		components: {
			RecordList,
			CustomLoading
		},
		computed: {
			...mapGetters(['token']),
			i18n() {
				return this.$t('message');
			},
		},
		data() {
			return {
				list: [],
				isEmpty: false
			}
		},
		mounted() {
			this.loadList()
			this.$refs.loading.open();
		},
		methods: {
			recordClick(id) {
				uni.navigateTo({
					url: '/pages/transferred/detail?id=' + id
				})
			},
			async loadList() {
				let {error, res} = await walletHzhistory({token: this.token});
				this.$refs.loading.close();
				if (error) return;
				this.list = res || [];
				this.isEmpty = true;
				for (let i in this.list) {
					this.list[i].create_time = this.list[i].add_time;
					this.list[i].address = this.list[i].type;
					this.list[i].status = this.list[i].status + 1;
				}
			}
		}
	}
</script>

<style>
</style>
